<div class="layuimini-container layuimini-page-anim">
    <div class="layuimini-main">
        <div class="layui-form">


            <fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
                <legend>新建销售合同</legend>
            </fieldset>

            <form class="layui-form" action="">
                <div class="layui-form-item">
                    <label class="layui-form-label">合同编号</label>
                    <div class="layui-input-block">
                        <input type="text" name="xsbCoNo" lay-verify="required" lay-reqtext="合同编号不能为空" autocomplete="off" placeholder="请输入合同编号(con-2020-1026-02)" class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">发货单主题
                    </label>
                    <div class="layui-input-block">
                        <input  name="xsbCoTheme" lay-verify="required" lay-reqtext="发货单主题不能为空" placeholder="请输入发货单主题" autocomplete="off" class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">计划单编号</label>
                    <div class="layui-input-block">
                        <input  name="plan.xsbDNo" lay-verify="required" lay-reqtext="计划单编号不能为空" placeholder="请输入计划单编号" autocomplete="off" class="layui-input">
                    </div>
                </div>
                  <div class="layui-form-item">
                    <div class="layui-inline">
                        <label class="layui-form-label">总金额</label>
                        <div class="layui-input-inline">
                            <input  name="xsbCoMoeny" lay-verify="required" lay-reqtext="总金额不能为空" placeholder="请输入总金额" autocomplete="off" class="layui-input">
                        </div>
                    </div>
                    <div class="layui-inline">
                        <label class="layui-form-label">客户</label>
                        <div class="layui-input-inline">
                            <input  name="client.xsbCName" lay-verify="required" lay-reqtext="客户姓名不能为空" placeholder="请输入客户姓名" autocomplete="off" class="layui-input">
                        </div>
                    </div>
                      <div class="layui-inline">
                          <label class="layui-form-label">业务员</label>
                          <div class="layui-input-inline">
                              <input  name="xsbCoName" lay-verify="required" lay-reqtext="业务员姓名不能为空" placeholder="请输入业务员姓名" autocomplete="off" class="layui-input">
                          </div>
                      </div>
                </div>

                <div class="layui-form-item">
                    <div class="layui-inline">
                        <label class="layui-form-label">发货人</label>
                        <div class="layui-input-inline">
                            <input  name="xsbCoConsignor" lay-verify="required" lay-reqtext="发货人不能为空" placeholder="请输入发货人地址" autocomplete="off" class="layui-input">
                        </div>
                    </div>
                    <div class="layui-inline">
                        <label class="layui-form-label">收货人</label>
                        <div class="layui-input-inline">
                            <input  name="xsbCoConsignee" lay-verify="required" lay-reqtext="收货人不能为空" placeholder="请输入收货人姓名" autocomplete="off" class="layui-input">
                        </div>
                    </div>
                </div>


                <div class="layui-form-item">
                    <div class="layui-inline">
                        <label class="layui-form-label">运输方式</label>
                        <div class="layui-input-inline">
                            <input  name="xsbCoTransport"  placeholder="请输入运输方式" autocomplete="off" class="layui-input">
                        </div>
                    </div>

                    <div class="layui-inline">
                        <label class="layui-form-label">创建时间</label>
                        <div class="layui-input-inline">
                            <input type="text" name="xsbCoCotime" lay-verify="required" lay-reqtext="请输入计划创建时间" class="layui-input" id="test5" >
                        </div>
                    </div>
                </div>



                <div class="layui-form-item">
                    <div class="layui-input-block">
                        <button class="layui-btn" lay-submit="" lay-filter="demo1">立即提交</button>
                        <button type="reset" class="layui-btn layui-btn-primary">重置</button>
                    </div>
                </div>
            </form>
        </div>
    </div>
</div>
<script>
    layui.use(['form',  'laydate'], function () {
        var form = layui.form
            , layer = layui.layer
            , laydate = layui.laydate;

        /**
         * 初始化表单，要加上，不然刷新部分组件可能会不加载
         */
        form.render();

        //日期
        laydate.render({
            elem: '#test5'
            ,type: 'datetime'
        });



        //监听提交
        form.on('submit(demo1)', function (data) {


            layer.alert(JSON.stringify(data.field), {
                title: '最终的提交信息'
            })
            $.ajax({
                type: "get",
                url: "/addContract",
                data: data.field,
            });

            return false;
        });






    });
</script>